#ifndef CONTROL_H
#define CONTROL_H

#include "keyboard.h"
#include "main.h"

struct keyb_map {
    // keyboard flags
    char pressed;
    
    // bound script
    short boundscript;
};

// for recording bound keys
extern struct keyb_map key_map[128];

// four button flags for GamePad
extern char b1;
extern char b2;
extern char b3;
extern char b4;

// stick position flags
extern char up;
extern char down;
extern char left;
extern char right;

// joystick x / y values
extern int jx;
extern int jy;

// found-flags for joystick read.
extern char foundx;
extern char foundy;

// stick-center values
extern int cenx;
extern int ceny;

// barriers for axis determination
extern int upb;
extern int downb;
extern int leftb;
extern int rightb;

// keyboard definable controls.
extern int kb1;
extern int kb2;
extern int kb3;
extern int kb4;

// joystick definable controls.
extern int jb1;
extern int jb2;
extern int jb3;
extern int jb4;
  
extern void initcontrols(char joystk);
extern void readb();
extern void readcontrols();
extern void readbuttons();
extern void getcoordinates();
extern int calibrate();
extern void readjoystick();

#endif
